<script type="text/javascript">
    jQuery(document).ready(function() {
       
    var sheepItForm = jQuery('#sheepItForm').sheepIt({
        separator: '',
        allowRemoveLast: true,
        allowRemoveCurrent: true,
        allowRemoveAll: true,
        allowAdd: true,
        allowAddN: true,
        maxFormsCount: 20,
        minFormsCount: 0,
        iniFormsCount: 1
    });
});
</script>
<?php echo $this->Form->create(null, array('url' => array('controller' => 'trabajos', 'action' => 'ajaxaddempleado/'.$idtrab))); ?>

<table>

<tr>
   <td>Empleados</td>
   <td>
   <!-- sheepIt Form -->
   <div id="sheepItForm">
   
   <!-- Form template-->
      <div id="sheepItForm_template">
      <?php echo $this->Form->hidden(null, array('name'=>"data[Empleadostrabajo][#index#][hojasruta_id]", 'value'=>$hojarutaid));?>
      <label for="sheepItForm_#index#_phone">Empleado <span id="sheepItForm_label"></span></label>
         <?php echo $this->Form->select(null, $empleados, array('name'=>"data[Empleadostrabajo][#index#][empleado_id]"));?>
      <label for="sheepItForm_#index#_machine">Maquina <span id="sheepItForm_label"></span></label>
        <?php echo $this->Form->select(null, $maquinas, array('name'=>"data[Empleadostrabajo][#index#][maquinaria_id]"));?>
      <a id="sheepItForm_remove_current">
        <?php echo $this->Html->image('buttons/cross.png',array('class'=>'delete'))?>
      </a>
       </div>
     <!-- /Form template-->
                   
     <!-- No forms template -->
     <div id="sheepItForm_noforms_template">Sin empleados</div>
     <!-- /No forms template-->
                   
     <!-- Controls -->
     <div id="sheepItForm_controls">
        <div id="sheepItForm_add" class="btn form add"><a><span>A&ntilde;adir</span></a></div>
        <div id="sheepItForm_remove_last" class="btn form remove"><a><span>Remover</span></a></div>
        <div id="sheepItForm_remove_all" class="btn form removeAll"><a><span>Remove todos</span></a></div>
      </div>        
      <!-- /Controls -->
   </div>
   <!-- /sheepIt Form -->
   </td>
</tr>
<tr>
   <td>
    <?php echo $this->Form->end('Anadir empleados');?>
   </td>
</tr>
</table>